﻿using System;

namespace IDNumber
{
    class Program
    {
        static void Main(string[] args)
        {
            string a;

            bool q = true;

            Console.WriteLine("请输入你的身份证;");

            a = Console.ReadLine();

            for (int b = 0; b <= a.Length - 1; b++)

            {
                if (a[b] >= '0' && a[b] <= '9')

                {
                    continue;

                }

                else

                    q = false;

            }
            if (a.Length == 18)

            {
                if (q == true)

                    Console.WriteLine("输入正确");

                else if (q == false)

                    Console.WriteLine("输入不合法,请重新输入");

            }

            else

                Console.WriteLine("输入不合法,请重新输入");
            Console.ReadKey();
        }
    }
}
